.class public Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;
.super Ljava/lang/Thread;
.source "AppUpdateService.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/netease/newsreader/download/AppUpdateService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "UpdateThread"
.end annotation


# instance fields
.field private UIHandler:Landroid/os/Handler;

.field private mContext:Landroid/content/Context;

.field private mDir:Ljava/lang/String;

.field private mSaveFile:Ljava/lang/String;

.field private mUrl:Ljava/lang/String;

.field final synthetic this$0:Lcom/netease/newsreader/download/AppUpdateService;


# direct methods
.method public constructor <init>(Lcom/netease/newsreader/download/AppUpdateService;Landroid/content/Context;Ljava/lang/String;)V
    .locals 4
    .parameter
    .parameter "context"
    .parameter "url"

    .prologue
    .line 136
    iput-object p1, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->this$0:Lcom/netease/newsreader/download/AppUpdateService;

    .line 127
    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    .line 181
    new-instance v2, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread$1;

    invoke-direct {v2, p0}, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread$1;-><init>(Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;)V

    iput-object v2, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->UIHandler:Landroid/os/Handler;

    .line 128
    iput-object p3, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mUrl:Ljava/lang/String;

    .line 129
    invoke-virtual {p1, p3}, Lcom/netease/newsreader/download/AppUpdateService;->getFileName(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mSaveFile:Ljava/lang/String;

    .line 130
    iput-object p2, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mContext:Landroid/content/Context;

    .line 131
    sget-object v2, Lcom/netease/newsreader/util/FileUtils;->FileTempDir:Ljava/lang/String;

    iput-object v2, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mDir:Ljava/lang/String;

    .line 133
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "file://"

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v3, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mDir:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mSaveFile:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    .line 134
    .local v1, uri:Landroid/net/Uri;
    new-instance v0, Ljava/io/File;

    invoke-virtual {v1}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v0, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 135
    .local v0, f:Ljava/io/File;
    invoke-static {v0}, Lcom/netease/newsreader/util/FileUtils;->deleteFile(Ljava/io/File;)Z

    return-void
.end method

.method static synthetic access$0(Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 124
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mUrl:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$1(Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;)Landroid/content/Context;
    .locals 1
    .parameter

    .prologue
    .line 125
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$2(Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;)Landroid/os/Handler;
    .locals 1
    .parameter

    .prologue
    .line 181
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->UIHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic access$3(Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;)Lcom/netease/newsreader/download/AppUpdateService;
    .locals 1
    .parameter

    .prologue
    .line 120
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->this$0:Lcom/netease/newsreader/download/AppUpdateService;

    return-object v0
.end method


# virtual methods
.method public run()V
    .locals 9

    .prologue
    const/4 v8, 0x2

    .line 140
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mUrl:Ljava/lang/String;

    if-eqz v0, :cond_0

    .line 142
    iget-object v7, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->this$0:Lcom/netease/newsreader/download/AppUpdateService;

    new-instance v0, Lcom/netease/newsreader/download/FileDownloader;

    iget-object v1, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mContext:Landroid/content/Context;

    iget-object v2, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mUrl:Ljava/lang/String;

    iget-object v3, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mDir:Ljava/lang/String;

    iget-object v4, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->mSaveFile:Ljava/lang/String;

    const/4 v5, 0x1

    invoke-direct/range {v0 .. v5}, Lcom/netease/newsreader/download/FileDownloader;-><init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V

    iput-object v0, v7, Lcom/netease/newsreader/download/AppUpdateService;->mDownLoader:Lcom/netease/newsreader/download/FileDownloader;

    .line 146
    :try_start_0
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->this$0:Lcom/netease/newsreader/download/AppUpdateService;

    iget-object v0, v0, Lcom/netease/newsreader/download/AppUpdateService;->mDownLoader:Lcom/netease/newsreader/download/FileDownloader;

    invoke-virtual {v0}, Lcom/netease/newsreader/download/FileDownloader;->initStatus()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 148
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->this$0:Lcom/netease/newsreader/download/AppUpdateService;

    iget-object v0, v0, Lcom/netease/newsreader/download/AppUpdateService;->mDownLoader:Lcom/netease/newsreader/download/FileDownloader;

    new-instance v1, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread$2;

    invoke-direct {v1, p0}, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread$2;-><init>(Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;)V

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/download/FileDownloader;->download(Lcom/netease/newsreader/download/DownloadProgressListener;)J
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 178
    :cond_0
    :goto_0
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->this$0:Lcom/netease/newsreader/download/AppUpdateService;

    invoke-virtual {v0}, Lcom/netease/newsreader/download/AppUpdateService;->stopSelf()V

    .line 179
    return-void

    .line 172
    :cond_1
    :try_start_1
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->UIHandler:Landroid/os/Handler;

    const/4 v1, 0x2

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    .line 174
    :catch_0
    move-exception v6

    .line 175
    .local v6, e:Ljava/lang/Exception;
    iget-object v0, p0, Lcom/netease/newsreader/download/AppUpdateService$UpdateThread;->UIHandler:Landroid/os/Handler;

    invoke-virtual {v0, v8}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    goto :goto_0
.end method
